#ifndef PROGRESSITEM_H
#define PROGRESSITEM_H

#include <QDate>
#include <QString>
#include <QDomElement>

/*
 * Encapsulates the user's progress with learning a single phrase.
 * Constitutes a single item in the progress report.
 *
 * User, phrase, lesson --> progress item
 */
class ProgressItem
{
public:
    ProgressItem();

    // various states of progress the item can be in
    enum ProgressStatus {TryAgain = 0, Revisit, Learnt};

    // accessors
    void setDuration(const long& d);
    void setLessonName(const QString& name);
    void setPhraseName(const QString& name);
    void setVideoFilename(const QString& f, const QString& u);
    void setStatus(ProgressItem::ProgressStatus s);

    // mutators
    const long& getDuration() const;
    const QString& getLessonName() const;
    const QString& getPhraseName() const;
    const QString& getVideoFilename() const;
    const QDate& getDate() const;
    ProgressItem::ProgressStatus getStatus();

    // xml functionality

    // convert to xml dom node
    QDomElement& toDomElement(QDomElement& node);
    // convert from xml dom node
    void fromDomElement(QDomElement& node);

    bool operator ==(const ProgressItem& other);

private:
    // date of progress
    QDate date;

    // time user spend on phrase, seconds
    long duration;

    // name of lesson associated with this progress item
    QString lessonName;

    // name of phrase associated with this progress item
    QString phraseName;

    // video file which the user has recorded
    QString videoFilename;

    // progress itself
    ProgressItem::ProgressStatus status;
};

#endif // PROGRESSITEM_H
